#ifndef _SEMAPHORE_H_
#define _SEMAPHORE_H_

typedef struct semaphoreCDT* semaphoreADT;

typedef enum SEM_COLOR {SEM_RED, SEM_GREEN} SEM_COLOR;
typedef enum SEM_ORIENTATION {SEM_VER, SEM_HOR} SEM_ORIENTATION;

enum SEM_SPEED {SEM_SLOW, SEM_NORMAL, SEM_FAST, SEM_CRAZY, NUM_SEM_SPEEDS};

//Second parameter is of type SEM_COLOR. Parameter 3 is of type ORIENTATION
semaphoreADT newSemaphore(int secs, int x, int y, drawerADT drawer);

void changeDuration(semaphoreADT semaphore, int newDuration);

void * startSemaphore(void * semaphore);

//returns a SEM_COLOR  value
int getColor(semaphoreADT semaphore, int orientation);

int getSemX(semaphoreADT semaphore);
int getSemY(semaphoreADT semaphore);
void freeSemaphore(semaphoreADT semaphore);

void waitSemaphoreToChange(semaphoreADT semaphoreInRed, int orientation);

void drawSem(semaphoreADT semaphore);

#endif
